import routes from "./routes";
const metas = {}; //对象用来存储所有路由的meta元信息
function getMeta(){
    for(let index in routes){
        deal_meta_route(routes[index]);
    }
}
//定义函数处理单个路由的元信息
function deal_meta_route(route){
    const {children, meta, path} = route;
    //添加当前路由的元信息
    metas[path] = (meta ? meta:{});
    if(children){
        //处理子级路由的元信息
        for(let index in children){
            let routeTemp = {...children[index], path:path+children[index].path};
            deal_meta_route(routeTemp);
        }
    }
} 
getMeta();
export default metas;